package com.lwj.springbootvue.mapper;

import com.lwj.springbootvue.model.User;
import com.lwj.springbootvue.model.dto.LoginDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    // 登錄
    public  String login(LoginDto loginDto);

    //

    // 查询用户名
    @Select("select * from tb_user where username=#{username}")
    public User selectOneByUsername(String username);

    // 注册用户
    @Insert("INSERT INTO tb_user(password, username, email) VALUES(#{password}, #{username}, #{email})")
    boolean insertUser(User user);


    // 根据utid查询 对应老师的账户
    @Select("select * from tb_user where utid=#{utid} ")
    public User selectUserByUtid(Long utid);


    // 更改密码
    void changeAdminPassword(User use);


}
